﻿using Wx.Standard.Model;
using Wx.Standard.Model.Share;

namespace Wx.Standard.IService
{
    public interface IWeb
    {
        /// <summary>
        /// 网页授权
        /// </summary>
        /// <param name="url">授权回跳地址</param>
        /// <param name="stata">授权回传参数</param>
        /// <param name="agree">是否弹出用户提示框</param>
        void Auth(string url, string stata = "", bool agree = true);
        /// <summary>
        /// 根据URL算出wx.config的几个参数
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        JsShare GetJsShareConfig(string url);
        /// <summary>
        /// 带参数二维码图片地址
        /// </summary>
        /// <param name="scene_id">数字</param>
        /// <param name="expire_seconds">有效秒数 0为永久  最大不超过2592000（即30天）</param>
        /// <returns></returns>
        string GetQRcodeImgSrc(int scene_id, int expire_seconds = 7200);
        /// <summary>
        /// 带参数二维码图片地址
        /// </summary>
        /// <param name="scene_str">字符串</param>
        /// <param name="expire_seconds">有效秒数 0为永久  最大不超过2592000（即30天）</param>
        /// <returns></returns>
        string GetQRcodeImgSrc(string scene_str, int expire_seconds = 7200);
        /// <summary>
        /// 远程图片转发 解决COCOS 跨域
        /// </summary>
        /// <param name="url">图片地址</param>
        /// <returns></returns>
        byte[] GetImg(string url);
        
        /// <summary>
        /// 授权用户获得信息
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        WeChatUser GetUserWithAuth(string code);
        /// <summary>
        /// 授权只获取openid，用于静默授权
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        string GetOpenidWithAuth(string code);
    }
}
